package com.burt.singleton;

/**
 * Description:
 * User: Administrator
 * Date: 2017-05-23
 * Time: 17:38
 */
public class SingletonTest {

    public static void main(String[] args){
        SuperManSingleton burtSingleton = SuperManSingleton.getInstance();
        burtSingleton.setName("Burt");
        burtSingleton.setSign("我是独一无二的");

        SuperManSingleton roseSingleton = SuperManSingleton.getInstance();
        roseSingleton.setName("Rose");
        roseSingleton.setSign("天下还能找到第二个我么？奸笑。。。");

        System.out.println("我叫 " + burtSingleton.getName() + "，我的签名是 " + burtSingleton.getSign());
        System.out.println("我叫 " + roseSingleton.getName() + "，我的签名是 " + roseSingleton.getSign());

        if(burtSingleton == roseSingleton){
            System.out.println("创建的是同一个实例" + burtSingleton.getName());
        }else{
            System.out.println("创建的不是同一个实例" + burtSingleton.getName());
        }
    }
}
